package lumis.portal.sendmail;

import java.io.InputStream;
import java.sql.Blob;

import lumis.portal.stability.StableMinor;

/**
 * Stores information about a mail attachment.
 * @since 4.0.4
 * @version $Revision: 13082 $ $Date: 2011-05-27 16:03:12 -0300 (Fri, 27 May 2011) $
 */
@StableMinor(version = "6.0", sinceVersion = "4.0")
public interface IMailAttachment
{
	/**
	 * Returns the mime content type of this attachment. 
	 * @return the mime content type of this attachment.
	 * @since 4.0.4
	 */
	public String getContentType();
	
	/**
	 * Sets the mime content type of this attachment.
	 * @param contentType the content type to set.
	 * @since 4.0.4
	 */
	public void setContentType(String contentType);
	
	/**
	 * Returns the name of this attachment.
	 * @return the name of this attachment.
	 * @since 4.0.4
	 */
	public String getName();

	/**
	 * Sets the name of this attachment.
	 * @param name the name value to set.
	 * @since 4.0.4
	 */
	public void setName(String name);
	
	/**
	 * Returns the description of this attachment.
	 * @return the description of this attachment.
	 * @since 4.0.4
	 */
	public String getDescription();

	/**
	 * Sets the description of this attachment.
	 * @param description the description value to set.
	 * @since 4.0.4
	 */
	public void setDescription(String description);

	/**
	 * Returns the content of this attachment. The blob
	 * returned is valid only during the transaction
	 * that generated it. 
	 * @return the content of this attachment.
	 * @since 4.0.4
	 */
	public Blob getContent();

	/** 
	 * Returns a unique identifier for this attachment.
	 * @return a unique identifier for this attachment.
	 * @since 4.0.4
	 */
	public String getId();

	/**
	 * Sets the content for this mail attachment.
	 * The content will be read from the given input stream
	 * during the manager's send methods. So the input stream
	 * must stay opened until the send method is called.
	 * @param inputStream the content input stream. 
	 * @since 4.0.4
	 */
	public void setContent(InputStream inputStream, int length);

	/**
	 * Gets the content input stream for this mail attachment.
	 * @param inputStream the content input stream. 
	 * @since 4.0.4
	 */
	public InputStream getContentInputStream();
}